<div class='mypg_left_out'><? include("inbox_left.php");?></div>

<div class='fullbox_out'>
<?php
if($_SESSION['user_type_sess']==3)
{
   include_once "my_swapen_merchant.php";
}
else if($_SESSION['user_type_sess']==1 || $_SESSION['user_type_sess']==2 || $_SESSION['user_type_sess']==4)
{
  include_once "my_swapen_seller.php";
}
else
{
     include("my_swapen_wholesaler.php");
}



if(isset($_POST['Submit']) && $_POST['Submit']=="Delete")
{
	$chktotal=count($_POST['chkDel']);
	if($chktotal>0)
	{
		for($i=0;$i<$chktotal;$i++)
		{
		mysql_query("delete from tbl_messages where messageid='".$_POST['chkDel'][$i]."'");
		}
		$_SESSION['msg']="Message Deleted Successfully";
	}
	else
	{
	    $_SESSION['msg']="Please select checkbox to delete message(s)";
	}
}
$message="select * from tbl_messages where recieverid='".$_SESSION['user_id_sess']."'";
$res=mysql_query($message);
$nrow=mysql_num_rows($res);
?>

<div id='panel'>
<form id="form1" name="form1" method="post" action="">
<div class="fulldiv" style="width:700px;">

<div class="fulldiv" style="margin:10px 0px 0px 0px;">
 	<div style="float:left; margin:0px 10px 0px 10px;"><strong class="orangehead">Inbox</strong></div>
</div>

<div class="fulldiv">
	<div class="greytab_out" style="float:left; margin:10px 5px -6px 10px;">
		<div class="greytab_left">&nbsp;</div>
		<div class="greytab_repeat"><!--Delete--><input class="button" type="submit" name="Submit" value="Delete" /></div>
		<div class="greytab_right">&nbsp;</div>
	</div>
</div>

<div class="fullbox_top">&nbsp;</div>
<div class="fullbox_repeat" >

<div class="fulldiv">

	<div class="mail_out">
		<div class="blue_inbox_box">
				<div class="bluebar_inbox_left"></div>
				<div class="bluebar_inbox_center">
					<div style="width:40px;" class="inbox_head1">&nbsp;</div>
					<div style="width:200px;" class="inbox_head1">From</div>
					<div style="width:300px;" class="inbox_head1">Subject</div>
					<div style="width:100px;" class="inbox_head1">Date</div>
				</div>
				<div class="bluebar_inbox_right"></div>
		</div>
		
		<div class="fulldiv">
		<?php
		if($_SESSION['msg'])
		{
		?>
		  <div class="mail_out2">
		    <div><font color="#FF0000"><strong><?php echo $_SESSION['msg']; $_SESSION['msg']="";?></strong></font></div>
		  </div>
		<?php
		}
		
		$i=0;
		while($mrow=mysql_fetch_array($res))
		{
			$i=1;
			if($mrow['senderid']==0)
			{
			$senderuser="Admin";
			}
			else
			{
			$sqlUser="select * from tbl_users where user_id='".$mrow['senderid']."'";
			$resUser=mysql_query($sqlUser);
			$rowUser=mysql_fetch_array($resUser);
			$senderuser=$rowUser['username'];
			}
			if($mrow['status']=="1")
			{
				$cls="class='inbox_head1'";
			}
			else
			{
				$cls="class='inbox_read'";
			}
		?>
			<div class="mail_out2">
				<div style="width:40px;" <?php echo $cls?>><input type="checkbox" name="chkDel[]" id="chkDel" value="<?php echo $mrow['messageid'];?>" /></div>
				<div style="width:200px;" <?php echo $cls?>><?php echo $senderuser?></div>
				<div style="width:300px;" <?php echo $cls?>><?php echo $mrow['subject'];?></div>
				<div style="width:100px;" <?php echo $cls?>><?php echo $mrow['posteddate'];?></div>
			</div>
		<?php
		}
		?>
		  
		</div>
		
	</div>

</div>
</div>
<div class="fullbox_bot">&nbsp;</div>

</div></form>
</div>

</div>